{extend name="base" /}
{block name="css"}

<link rel="stylesheet" href="https://paidou.cdn.dgyunju.cn/css/search.css?{$version|default=100}">
<link rel="stylesheet" href="https://paidou.cdn.dgyunju.cn/css/common.css?{$version|default=100}">
<link rel="stylesheet" href="https://paidou.cdn.dgyunju.cn/fonts/iconfont.css">
<link rel="stylesheet" href="https://paidou.cdn.dgyunju.cn/css/search.css?v={$version}">
<link rel="stylesheet" href="https://paidou.cdn.dgyunju.cn/fonts/iconfont.css?v={$version}">
{/block}
{block name="content"}
<div id="container">
    <div id="header"></div>
    <div id="rightside"></div>
    <div id="content">
        <div class="search-container">
                <form action="__DOMAIN__/search" method="get" class="top-search" id="form">
                <input class="search-input" placeholder="{:lang('search_input_placeholder')}" value="{$keyword|default=''}" type="text" name="keyword">
                <button class="btn" type="submit">
                    <i class="fi fi-search"></i>
                    <span>{:lang('search')}</span>
                </button>
                    <input type="hidden" name="type" id="type" value="{$type|default=1}">
                </form>
            <ul class="tabs" id="tab">
                <li class="li-list {if $type == 1}active{/if}" data-id="1">{:lang('search_type_product')}</li>
                <li class="li-list  {if $type ==2}active{/if}" data-id="2">{:lang('search_type_news')}</li>
                <li class="li-list  {if $type == 3}active{/if}" data-id="3">{:lang('search_type_download')}</li>
            </ul>
            <div class="search-content-list">
                {notempty name='err_info'}{$err_info}{/notempty}
                {notempty name="list"}
                 {if $list['total'] >0}
                    {foreach $list['data'] as $vo}
                    <a target="_blank" href="{$type==1?'product/'.$vo['id']:$type==2?'news/'.$vo['id']:$vo['file_path']}" class="content-list" >
                        <img class="search-img" data-original="{$vo['cover']|default=$config['logo']}?imageView2/1/w/200" alt="{$vo['title']|default=''}">
                        <div class="right">
                            {$vo['title']}
                        </div>
                    </a>
                    {/foreach}
                {else}
                <div class="no-data">
                    <img class="no-img" src="https://paidou.cdn.dgyunju.cn/image/nodata.png" alt="">
                    <p>{:lang('no_data')}</p>
                </div>
                {/if}
                {/notempty}
            </div>

            <div id="pagination" class="l-page"></div>
        </div>
    </div>
    <div id="footer"></div>

</div>
{/block}
{block name="script"}
<script src="https://paidou.cdn.dgyunju.cn/js/lazyload.js?v={$version}"></script>
<script src="https://paidou.cdn.dgyunju.cn/js/pagination.min.js?v={$version}"></script>
<script>
    $(function(){
        $('.tabs .li-list').on('click',function(e){
            e.preventDefault()
            $that=$(this)
            $('.tabs .li-list').removeClass('active')
            $that.addClass('active')
            let id = $that.attr("data-id");
            $("#type").val(id);
            setTimeout(()=>{
                $("#form").submit();
            },1000  )
        })
        $("#pagination").pagination({
            currentPage:{$list['current_page']|default=1},
            totalPage:{$list['totalPage']|default=1},
            /*是否显示首页、尾页 true：显示 false：不显示*/
            isShow:true,
            /*分页条显示可见页码数量*/
            count:10,
            /*第一页显示文字*/
            homePageText:"{:lang('homePageText')}",
            /*最后一页显示文字*/
            endPageText:"{:lang('endPageText')}",
            /*上一页显示文字*/
            prevPageText:"{:lang('prevPageText')}",
            /* 下一页显示文字*/
            nextPageText:"{:lang('nextPageText')}",
            /*点击翻页绑定事件*/
            callback: function(page) {
                window.location.href = "{:url('/search',['keyword'=>$keyword,'type'=>$type])}" +"&page="+page;
            }
        });
    });
</script>
{/block}